import 'package:json_annotation/json_annotation.dart';
import 'package:travel/utils/colors.dart';

part 'hotel.g.dart';

@JsonSerializable()
class HotelModel {
  String name;

  String address;

  int price;

  String area;

  String imgUrl;

  HotelModel(
      {required this.name,
      required this.address,
      required this.price,
      required this.area,
      required this.imgUrl});

  factory HotelModel.fromJson(Map<String, dynamic> json) => _$HotelModelFromJson(json);

  Map<String, dynamic> toJson() => _$HotelModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class HotelTypeModel {
  final String name;

  final String icon;

  HotelTypeModel({required this.name, required this.icon});
}

@JsonSerializable()
class HotelOrderModel {
  int type;

  String name;

  String address;

  String startDate;

  String endDate;

  String describe;

  String house;

  int status;

  int price;

  HotelOrderModel(
      {required this.type,
      required this.name,
      required this.address,
      required this.startDate,
      required this.endDate,
      required this.describe,
      required this.house,
      required this.status,
      required this.price});

  factory HotelOrderModel.fromJson(Map<String, dynamic> json) => _$HotelOrderModelFromJson(json);

  Map<String, dynamic> toJson() => _$HotelOrderModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

/// 酒店订单状态
enum HotelOrderStatusEnum {
  unpaid(label: '待支付', value: 1, color: ColorsUtils.color3478),
  unused(label: '未使用', value: 2, color: ColorsUtils.color3478),
  cancelled(label: '已取消', value: 3, color: ColorsUtils.color6666),
  used(label: '已使用', value: 4, color: ColorsUtils.color6666);

  final String label;
  final int value;
  final String color;

  const HotelOrderStatusEnum({required this.label, required this.value, required this.color});
}

/// 订单类型
enum OrderTypeEnum {
  hotel(label: '酒店', value: 1),
  admission(label: '门票', value: 2),
  air(label: '机票', value: 3),
  fare(label: '车票', value: 4);

  final String label;
  final int value;

  const OrderTypeEnum({required this.label, required this.value});
}

/// 门票订单状态
enum AdmissionOrderStatusEnum {
  unpaid(label: '待支付', value: 1, color: ColorsUtils.color3478),
  unused(label: '未使用', value: 2, color: ColorsUtils.color3478),
  cancelled(label: '已取消', value: 3, color: ColorsUtils.color6666),
  used(label: '已使用', value: 4, color: ColorsUtils.color6666);

  final String label;
  final int value;
  final String color;

  const AdmissionOrderStatusEnum({required this.label, required this.value, required this.color});
}
